import pymysql
from sqlalchemy import create_engine
import os
class Config(object):
    pass
    # database1="jiaoyu"

    # DIALECT = 'mysql'
    # DRIVER = 'pymysql'
    # USERNAME = 'root'
    # PASSWORD = 'root'
    # HOST = 'localhost'
    # PORT = 3306

    # conn = pymysql.connect(
    #     host=HOST,  # 你的主机IP
    #     port=PORT,  # 主机端口，不能加双引号
    #     user=USERNAME,  # MySQL用户
    #     password=PASSWORD,  # MySQL密码
    #     charset='utf8'  # 使用的编码格式，不能使用  utf-8 ，不能加多一个横杠
    # )
    # db = conn.cursor()  # 创建光标
    # db.execute("create database if not exists {} character set utf8;".format(database1))  # 创建数据库
    # db.execute("use {};".format(database1))
    # print("创建成功")
    # conn.commit()  # 一定要进行事务更新

# project_root=os.path.dirname(os.path.dirname(__file__))
# database_path = os.path.join(project_root,"database.db")

class DevConfig(Config):
    # sqlite,db放在当前目录

    # 获取工程的根目录,绝对路径,windows下为所在盘的根目录的
    database_path="/data.db"
    SQLALCHEMY_DATABASE_URI='sqlite:///'+database_path

    # SQLALCHEMY_DATABASE_URI = "{}+{}://{}:{}@{}:{}/{}?charset=utf8".format("mysql", "pymysql", "root", "root", "localhost", 3306, "jiaoyu")
    engine = create_engine(SQLALCHEMY_DATABASE_URI, echo=True)












